#ifndef  __IPZ_ZBC_FILTER_H_
#define	 __IPZ_ZBC_FILTER_H_

#ifdef	__PLATFORM_STATISTIC_H_
	#define	PLATFORM_STATISTIC_EXT	
#else
	#define	PLATFORM_STATISTIC_EXT	extern
#endif


#define BLEND_SHIFT 6
#define ALPHA 29 // 0.45
#define BELTA 54 // 0.85
#define HI_SUCCESS 0
#define HI_S32 int
#define HI_U16 unsigned short

#define AF_WIN_ROW      8
#define AF_WIN_COLUMN   8


//3A配置-海思结构体
#define AE_ZONE_ROW          (15)
#define AE_ZONE_COLUMN       (17)


#define ZBC_CALCULATE_SYSGAIN(ag, dg, ispdg, sysgain)\
do{\
    SW_UINT64 u64Tmp;\
    u64Tmp = (ag);\
    u64Tmp = (u64Tmp * (dg)) >> 10;\
    u64Tmp = (u64Tmp * (ispdg)) >> 10;\
    (sysgain)   = (SW_UINT32)u64Tmp;\
}while(0)




typedef enum _IPC_ISP_FOCUS_STATCFG_MODE
{
	IPC_ISP_FOCUS_STATCFGM_DAY = 0,
	IPC_ISP_FOCUS_STATCFGM_NIGHT,
	IPC_ISP_FOCUS_STATCFGM_DOTLIGHT,
	IPC_ISP_FOCUS_STATCFGM_NUM
}IPC_ISP_FOCUS_STATCFG_MODE;


typedef struct 
{
	SW_UINT y[25];
	SW_UINT allY[255];
	SW_UINT avgY;
	SW_UINT y1[25];
	SW_UINT y2[25];
	SW_UINT y3[25];
}AEDWinInfo;

typedef struct
{
	SW_INT SumLWin;
	SW_INT SumHWin;
	SW_INT DetLWin;
	SW_INT DetHWin;
	SW_INT HighCntWin;
  	SW_INT AllHistPixel;
	SW_INT sumh1;
	SW_INT sumh2;
	SW_INT sumv1;
	SW_INT sumv2;
	
	
	
}AFDWinInfo;

typedef struct
{
	SW_INT Hist5Value[5];
	SW_INT Hist16Value[16];
	SW_INT Hist256Value[256];
	SW_INT HistZone5Value[AE_ZONE_ROW][AE_ZONE_COLUMN][5]; 
}HISTInfo;

typedef struct
{
	SW_INT SumH;
	SW_INT SumL ;
	SW_INT HLCnt;
	SW_INT DetH;
	SW_INT DetL ;
	SW_INT DetCnt;
}AFDInfo, *pAFDInfo;


PLATFORM_STATISTIC_EXT AFDWinInfo ALLAFD;		//当前场AFD
PLATFORM_STATISTIC_EXT AEDWinInfo ALLAED;		//当前场AFD
PLATFORM_STATISTIC_EXT HISTInfo   ALLHIST;		//当前场AFD
PLATFORM_STATISTIC_EXT SW_BOOL    KEYAREAFLAG;	//当前场AFD

PLATFORM_STATISTIC_EXT AFDInfo 	NowAFD;	
PLATFORM_STATISTIC_EXT AFDInfo 	LastAFD;	
	

extern SW_INT32 GetAFAEFromHIsi(SW_UINT16);
extern SW_INT8 InitAFAEPar(SW_INT);
extern void Get3ADataThread(void);
extern SW_BOOL IsSky(void);
extern SW_BOOL IPZ_ZBC_FILTER_GetVDFlag(SW_INT s32Opt);
extern SW_VOID IPZ_ZBC_FILTER_SetVDFlag(SW_INT s32Opt,SW_BOOL bflag);



#endif

